package mylibrary.thread.blockingQueue;

import java.io.File;
import java.util.Scanner;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class BlockingQueueTest {
	
	public static void main(String[] args) {
		
//		Scanner in = new Scanner(System.in);
//		System.out.println("Enter base directory (c:\\)");
//		String directory = in.nextLine();
		String directory = "D:\\workspace\\DEV_EE_INT";
		
		System.out.println("Enter keyword(volatile)");
		//String keyword = in.nextLine();
		String keyword = "manager";
		
		
		final int FILE_QUEUE_SIZE = 10;
		final int SEARCH_THREADS = 100;
		
		BlockingQueue queue = new ArrayBlockingQueue(FILE_QUEUE_SIZE);
		
		FileEnumerationTask enumerator = new FileEnumerationTask(queue, new File(directory));
		new Thread(enumerator).start();
		
		for(int i=0; i<100; i++) {
			new Thread(new SearchTask(queue, keyword)).start();
		}
		
	} 
	
}
